coffeeStream = require '../utils/coffeeStream.coffee'
concat       = require 'gulp-concat'
gulp         = require 'gulp'
ngAnnotate   = require 'gulp-ng-annotate'
paths        = require('../config.coffee').paths
uglify       = require 'gulp-uglify'
rev          = require 'gulp-rev'

gulp.task 'scripts-optimize', ->
    gulp.src(paths.scripts)
        .pipe(coffeeStream())
        .pipe(concat('app.js'))
        .pipe(ngAnnotate())
        .pipe(uglify())
        .pipe rev()
        .pipe(gulp.dest(paths.dest))
        .pipe rev.manifest()
        .pipe(gulp.dest('rev/js'))

